package com.ibm.risk.irmp.workflow.client.flowable.api;

import com.ibm.risk.irmp.workflow.client.flowable.ApiClient;
import com.ibm.risk.irmp.workflow.client.flowable.model.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.ParameterizedTypeReference;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpMethod;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Component;
import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap;
import org.springframework.web.client.HttpClientErrorException;
import org.springframework.web.client.RestClientException;
import org.springframework.web.util.UriComponentsBuilder;

import java.util.HashMap;
import java.util.List;
import java.util.Map;


@Component("com.ibm.risk.irmp.flowable.api.ProcessDefinitionsApi")
public class ProcessDefinitionsApi {
    private ApiClient apiClient;

    public ProcessDefinitionsApi() {
        this(new ApiClient());
    }

    @Autowired
    public ProcessDefinitionsApi(ApiClient apiClient) {
        this.apiClient = apiClient;
    }

    public ApiClient getApiClient() {
        return apiClient;
    }

    public void setApiClient(ApiClient apiClient) {
        this.apiClient = apiClient;
    }

    /**
     * Batch migrate all instances of process definition
     *
     * <p><b>200</b> - Indicates process instances were found and batch migration was started.
     * <p><b>404</b> - Indicates the requested process definition was not found.
     * @param processDefinitionId The processDefinitionId parameter
     * @param body The body parameter
     * @throws RestClientException if an error occurs while attempting to invoke the API
     */
    public void batchMigrateInstancesOfProcessDefinition(String processDefinitionId, String body) throws RestClientException {
        Object postBody = body;

        // verify the required parameter 'processDefinitionId' is set
        if (processDefinitionId == null) {
            throw new HttpClientErrorException(HttpStatus.BAD_REQUEST, "Missing the required parameter 'processDefinitionId' when calling batchMigrateInstancesOfProcessDefinition");
        }

        // create path and map variables
        final Map<String, Object> uriVariables = new HashMap<String, Object>();
        uriVariables.put("processDefinitionId", processDefinitionId);
        String path = UriComponentsBuilder.fromPath("/repository/process-definitions/{processDefinitionId}/batch-migrate").buildAndExpand(uriVariables).toUriString();

        final MultiValueMap<String, String> queryParams = new LinkedMultiValueMap<String, String>();
        final HttpHeaders headerParams = new HttpHeaders();
        final MultiValueMap<String, Object> formParams = new LinkedMultiValueMap<String, Object>();

        final String[] accepts = {
            "application/json"
        };
        final List<MediaType> accept = apiClient.selectHeaderAccept(accepts);
        final String[] contentTypes = { };
        final MediaType contentType = apiClient.selectHeaderContentType(contentTypes);

        String[] authNames = new String[] { "basicAuth" };

        ParameterizedTypeReference<Void> returnType = new ParameterizedTypeReference<Void>() {};
        apiClient.invokeAPI(path, HttpMethod.POST, queryParams, postBody, headerParams, formParams, accept, contentType, authNames, returnType);
    }
    /**
     * Add a candidate starter to a process definition
     * It is possible to add either a user or a group.
     * <p><b>200</b> - successful operation
     * <p><b>201</b> - Indicates the process definition was found and the identity link was created.
     * <p><b>400</b> - Indicates the body does not contain the correct information.
     * <p><b>404</b> - Indicates the requested process definition was not found.
     * @param processDefinitionId The processDefinitionId parameter
     * @param body The body parameter
     * @return RestIdentityLink
     * @throws RestClientException if an error occurs while attempting to invoke the API
     */
    public RestIdentityLink createIdentityLink(String processDefinitionId, RestIdentityLink body) throws RestClientException {
        Object postBody = body;

        // verify the required parameter 'processDefinitionId' is set
        if (processDefinitionId == null) {
            throw new HttpClientErrorException(HttpStatus.BAD_REQUEST, "Missing the required parameter 'processDefinitionId' when calling createIdentityLink");
        }

        // create path and map variables
        final Map<String, Object> uriVariables = new HashMap<String, Object>();
        uriVariables.put("processDefinitionId", processDefinitionId);
        String path = UriComponentsBuilder.fromPath("/repository/process-definitions/{processDefinitionId}/identitylinks").buildAndExpand(uriVariables).toUriString();

        final MultiValueMap<String, String> queryParams = new LinkedMultiValueMap<String, String>();
        final HttpHeaders headerParams = new HttpHeaders();
        final MultiValueMap<String, Object> formParams = new LinkedMultiValueMap<String, Object>();

        final String[] accepts = {
            "application/json"
        };
        final List<MediaType> accept = apiClient.selectHeaderAccept(accepts);
        final String[] contentTypes = { };
        final MediaType contentType = apiClient.selectHeaderContentType(contentTypes);

        String[] authNames = new String[] { "basicAuth" };

        ParameterizedTypeReference<RestIdentityLink> returnType = new ParameterizedTypeReference<RestIdentityLink>() {};
        return apiClient.invokeAPI(path, HttpMethod.POST, queryParams, postBody, headerParams, formParams, accept, contentType, authNames, returnType);
    }
    /**
     * Delete a candidate starter from a process definition
     *
     * <p><b>204</b> - Indicates the process definition was found and the identity link was removed. The response body is intentionally empty.
     * <p><b>404</b> - Indicates the requested process definition was not found or the process definition does not have an identity-link that matches the url.
     * @param processDefinitionId The processDefinitionId parameter
     * @param family The family parameter
     * @param identityId The identityId parameter
     * @throws RestClientException if an error occurs while attempting to invoke the API
     */
    public void deleteIdentityLink(String processDefinitionId, String family, String identityId) throws RestClientException {
        Object postBody = null;

        // verify the required parameter 'processDefinitionId' is set
        if (processDefinitionId == null) {
            throw new HttpClientErrorException(HttpStatus.BAD_REQUEST, "Missing the required parameter 'processDefinitionId' when calling deleteIdentityLink");
        }

        // verify the required parameter 'family' is set
        if (family == null) {
            throw new HttpClientErrorException(HttpStatus.BAD_REQUEST, "Missing the required parameter 'family' when calling deleteIdentityLink");
        }

        // verify the required parameter 'identityId' is set
        if (identityId == null) {
            throw new HttpClientErrorException(HttpStatus.BAD_REQUEST, "Missing the required parameter 'identityId' when calling deleteIdentityLink");
        }

        // create path and map variables
        final Map<String, Object> uriVariables = new HashMap<String, Object>();
        uriVariables.put("processDefinitionId", processDefinitionId);
        uriVariables.put("family", family);
        uriVariables.put("identityId", identityId);
        String path = UriComponentsBuilder.fromPath("/repository/process-definitions/{processDefinitionId}/identitylinks/{family}/{identityId}").buildAndExpand(uriVariables).toUriString();

        final MultiValueMap<String, String> queryParams = new LinkedMultiValueMap<String, String>();
        final HttpHeaders headerParams = new HttpHeaders();
        final MultiValueMap<String, Object> formParams = new LinkedMultiValueMap<String, Object>();

        final String[] accepts = { };
        final List<MediaType> accept = apiClient.selectHeaderAccept(accepts);
        final String[] contentTypes = { };
        final MediaType contentType = apiClient.selectHeaderContentType(contentTypes);

        String[] authNames = new String[] { "basicAuth" };

        ParameterizedTypeReference<Void> returnType = new ParameterizedTypeReference<Void>() {};
        apiClient.invokeAPI(path, HttpMethod.DELETE, queryParams, postBody, headerParams, formParams, accept, contentType, authNames, returnType);
    }
    /**
     * Execute actions for a process definition
     * Execute actions for a process definition (Update category, Suspend or Activate)
     * <p><b>200</b> - Indicates action has been executed for the specified process. (category altered, activate or suspend)
     * <p><b>400</b> - Indicates no category was defined in the request body.
     * <p><b>404</b> - Indicates the requested process definition was not found.
     * <p><b>409</b> - Indicates the requested process definition is already suspended or active.
     * @param processDefinitionId The processDefinitionId parameter
     * @param body The body parameter
     * @return ProcessDefinitionResponse
     * @throws RestClientException if an error occurs while attempting to invoke the API
     */
    public ProcessDefinitionResponse executeProcessDefinitionAction(String processDefinitionId, ProcessDefinitionActionRequest body) throws RestClientException {
        Object postBody = body;

        // verify the required parameter 'processDefinitionId' is set
        if (processDefinitionId == null) {
            throw new HttpClientErrorException(HttpStatus.BAD_REQUEST, "Missing the required parameter 'processDefinitionId' when calling executeProcessDefinitionAction");
        }

        // verify the required parameter 'body' is set
        if (body == null) {
            throw new HttpClientErrorException(HttpStatus.BAD_REQUEST, "Missing the required parameter 'body' when calling executeProcessDefinitionAction");
        }

        // create path and map variables
        final Map<String, Object> uriVariables = new HashMap<String, Object>();
        uriVariables.put("processDefinitionId", processDefinitionId);
        String path = UriComponentsBuilder.fromPath("/repository/process-definitions/{processDefinitionId}").buildAndExpand(uriVariables).toUriString();

        final MultiValueMap<String, String> queryParams = new LinkedMultiValueMap<String, String>();
        final HttpHeaders headerParams = new HttpHeaders();
        final MultiValueMap<String, Object> formParams = new LinkedMultiValueMap<String, Object>();

        final String[] accepts = {
            "application/json"
        };
        final List<MediaType> accept = apiClient.selectHeaderAccept(accepts);
        final String[] contentTypes = { };
        final MediaType contentType = apiClient.selectHeaderContentType(contentTypes);

        String[] authNames = new String[] { "basicAuth" };

        ParameterizedTypeReference<ProcessDefinitionResponse> returnType = new ParameterizedTypeReference<ProcessDefinitionResponse>() {};
        return apiClient.invokeAPI(path, HttpMethod.PUT, queryParams, postBody, headerParams, formParams, accept, contentType, authNames, returnType);
    }
    /**
     * Get a process definition BPMN model
     *
     * <p><b>200</b> - Indicates the process definition was found and the model is returned. The response contains the full process definition model.
     * <p><b>404</b> - Indicates the requested process definition was not found.
     * @param processDefinitionId The processDefinitionId parameter
     * @return BpmnModel
     * @throws RestClientException if an error occurs while attempting to invoke the API
     */
    public BpmnModel getBpmnModelResource(String processDefinitionId) throws RestClientException {
        Object postBody = null;

        // verify the required parameter 'processDefinitionId' is set
        if (processDefinitionId == null) {
            throw new HttpClientErrorException(HttpStatus.BAD_REQUEST, "Missing the required parameter 'processDefinitionId' when calling getBpmnModelResource");
        }

        // create path and map variables
        final Map<String, Object> uriVariables = new HashMap<String, Object>();
        uriVariables.put("processDefinitionId", processDefinitionId);
        String path = UriComponentsBuilder.fromPath("/repository/process-definitions/{processDefinitionId}/model").buildAndExpand(uriVariables).toUriString();

        final MultiValueMap<String, String> queryParams = new LinkedMultiValueMap<String, String>();
        final HttpHeaders headerParams = new HttpHeaders();
        final MultiValueMap<String, Object> formParams = new LinkedMultiValueMap<String, Object>();

        final String[] accepts = {
            "application/json"
        };
        final List<MediaType> accept = apiClient.selectHeaderAccept(accepts);
        final String[] contentTypes = { };
        final MediaType contentType = apiClient.selectHeaderContentType(contentTypes);

        String[] authNames = new String[] { "basicAuth" };

        ParameterizedTypeReference<BpmnModel> returnType = new ParameterizedTypeReference<BpmnModel>() {};
        return apiClient.invokeAPI(path, HttpMethod.GET, queryParams, postBody, headerParams, formParams, accept, contentType, authNames, returnType);
    }
    /**
     * Get a candidate starter from a process definition
     *
     * <p><b>200</b> - Indicates the process definition was found and the identity link was returned.
     * <p><b>404</b> - Indicates the requested process definition was not found or the process definition does not have an identity-link that matches the url.
     * @param processDefinitionId The processDefinitionId parameter
     * @param family The family parameter
     * @param identityId The identityId parameter
     * @return RestIdentityLink
     * @throws RestClientException if an error occurs while attempting to invoke the API
     */
    public RestIdentityLink getIdentityLink(String processDefinitionId, String family, String identityId) throws RestClientException {
        Object postBody = null;

        // verify the required parameter 'processDefinitionId' is set
        if (processDefinitionId == null) {
            throw new HttpClientErrorException(HttpStatus.BAD_REQUEST, "Missing the required parameter 'processDefinitionId' when calling getIdentityLink");
        }

        // verify the required parameter 'family' is set
        if (family == null) {
            throw new HttpClientErrorException(HttpStatus.BAD_REQUEST, "Missing the required parameter 'family' when calling getIdentityLink");
        }

        // verify the required parameter 'identityId' is set
        if (identityId == null) {
            throw new HttpClientErrorException(HttpStatus.BAD_REQUEST, "Missing the required parameter 'identityId' when calling getIdentityLink");
        }

        // create path and map variables
        final Map<String, Object> uriVariables = new HashMap<String, Object>();
        uriVariables.put("processDefinitionId", processDefinitionId);
        uriVariables.put("family", family);
        uriVariables.put("identityId", identityId);
        String path = UriComponentsBuilder.fromPath("/repository/process-definitions/{processDefinitionId}/identitylinks/{family}/{identityId}").buildAndExpand(uriVariables).toUriString();

        final MultiValueMap<String, String> queryParams = new LinkedMultiValueMap<String, String>();
        final HttpHeaders headerParams = new HttpHeaders();
        final MultiValueMap<String, Object> formParams = new LinkedMultiValueMap<String, Object>();

        final String[] accepts = {
            "application/json"
        };
        final List<MediaType> accept = apiClient.selectHeaderAccept(accepts);
        final String[] contentTypes = { };
        final MediaType contentType = apiClient.selectHeaderContentType(contentTypes);

        String[] authNames = new String[] { "basicAuth" };

        ParameterizedTypeReference<RestIdentityLink> returnType = new ParameterizedTypeReference<RestIdentityLink>() {};
        return apiClient.invokeAPI(path, HttpMethod.GET, queryParams, postBody, headerParams, formParams, accept, contentType, authNames, returnType);
    }
    /**
     * Get a process definition image
     *
     * <p><b>200</b> - Indicates request was successful and the process-definitions are returned
     * <p><b>404</b> - Indicates the requested process definition was not found.
     * @param processDefinitionId The processDefinitionId parameter
     * @return List&lt;byte[]&gt;
     * @throws RestClientException if an error occurs while attempting to invoke the API
     */
    public List<byte[]> getModelResource(String processDefinitionId) throws RestClientException {
        Object postBody = null;

        // verify the required parameter 'processDefinitionId' is set
        if (processDefinitionId == null) {
            throw new HttpClientErrorException(HttpStatus.BAD_REQUEST, "Missing the required parameter 'processDefinitionId' when calling getModelResource");
        }

        // create path and map variables
        final Map<String, Object> uriVariables = new HashMap<String, Object>();
        uriVariables.put("processDefinitionId", processDefinitionId);
        String path = UriComponentsBuilder.fromPath("/repository/process-definitions/{processDefinitionId}/image").buildAndExpand(uriVariables).toUriString();

        final MultiValueMap<String, String> queryParams = new LinkedMultiValueMap<String, String>();
        final HttpHeaders headerParams = new HttpHeaders();
        final MultiValueMap<String, Object> formParams = new LinkedMultiValueMap<String, Object>();

        final String[] accepts = {
            "image/png"
        };
        final List<MediaType> accept = apiClient.selectHeaderAccept(accepts);
        final String[] contentTypes = { };
        final MediaType contentType = apiClient.selectHeaderContentType(contentTypes);

        String[] authNames = new String[] { "basicAuth" };

        ParameterizedTypeReference<List<byte[]>> returnType = new ParameterizedTypeReference<List<byte[]>>() {};
        return apiClient.invokeAPI(path, HttpMethod.GET, queryParams, postBody, headerParams, formParams, accept, contentType, authNames, returnType);
    }
    /**
     * Get a process definition
     *
     * <p><b>200</b> - Indicates request was successful and the process-definitions are returned
     * <p><b>404</b> - Indicates the requested process definition was not found.
     * @param processDefinitionId The processDefinitionId parameter
     * @return ProcessDefinitionResponse
     * @throws RestClientException if an error occurs while attempting to invoke the API
     */
    public ProcessDefinitionResponse getProcessDefinition(String processDefinitionId) throws RestClientException {
        Object postBody = null;

        // verify the required parameter 'processDefinitionId' is set
        if (processDefinitionId == null) {
            throw new HttpClientErrorException(HttpStatus.BAD_REQUEST, "Missing the required parameter 'processDefinitionId' when calling getProcessDefinition");
        }

        // create path and map variables
        final Map<String, Object> uriVariables = new HashMap<String, Object>();
        uriVariables.put("processDefinitionId", processDefinitionId);
        String path = UriComponentsBuilder.fromPath("/repository/process-definitions/{processDefinitionId}").buildAndExpand(uriVariables).toUriString();

        final MultiValueMap<String, String> queryParams = new LinkedMultiValueMap<String, String>();
        final HttpHeaders headerParams = new HttpHeaders();
        final MultiValueMap<String, Object> formParams = new LinkedMultiValueMap<String, Object>();

        final String[] accepts = {
            "application/json"
        };
        final List<MediaType> accept = apiClient.selectHeaderAccept(accepts);
        final String[] contentTypes = { };
        final MediaType contentType = apiClient.selectHeaderContentType(contentTypes);

        String[] authNames = new String[] { "basicAuth" };

        ParameterizedTypeReference<ProcessDefinitionResponse> returnType = new ParameterizedTypeReference<ProcessDefinitionResponse>() {};
        return apiClient.invokeAPI(path, HttpMethod.GET, queryParams, postBody, headerParams, formParams, accept, contentType, authNames, returnType);
    }
    /**
     * Get a process definition resource content
     *
     * <p><b>200</b> - Indicates both process definition and resource have been found and the resource data has been returned.
     * <p><b>404</b> - Indicates the requested process definition was not found or there is no resource with the given id present in the process definition. The status-description contains additional information.
     * @param processDefinitionId The processDefinitionId parameter
     * @return List&lt;byte[]&gt;
     * @throws RestClientException if an error occurs while attempting to invoke the API
     */
    public List<byte[]> getProcessDefinitionResource(String processDefinitionId) throws RestClientException {
        Object postBody = null;

        // verify the required parameter 'processDefinitionId' is set
        if (processDefinitionId == null) {
            throw new HttpClientErrorException(HttpStatus.BAD_REQUEST, "Missing the required parameter 'processDefinitionId' when calling getProcessDefinitionResource");
        }

        // create path and map variables
        final Map<String, Object> uriVariables = new HashMap<String, Object>();
        uriVariables.put("processDefinitionId", processDefinitionId);
        String path = UriComponentsBuilder.fromPath("/repository/process-definitions/{processDefinitionId}/resourcedata").buildAndExpand(uriVariables).toUriString();

        final MultiValueMap<String, String> queryParams = new LinkedMultiValueMap<String, String>();
        final HttpHeaders headerParams = new HttpHeaders();
        final MultiValueMap<String, Object> formParams = new LinkedMultiValueMap<String, Object>();

        final String[] accepts = { };
        final List<MediaType> accept = apiClient.selectHeaderAccept(accepts);
        final String[] contentTypes = { };
        final MediaType contentType = apiClient.selectHeaderContentType(contentTypes);

        String[] authNames = new String[] { "basicAuth" };

        ParameterizedTypeReference<List<byte[]>> returnType = new ParameterizedTypeReference<List<byte[]>>() {};
        return apiClient.invokeAPI(path, HttpMethod.GET, queryParams, postBody, headerParams, formParams, accept, contentType, authNames, returnType);
    }
    /**
     * Get a process definition start form
     *
     * <p><b>200</b> - Indicates request was successful and the process definition form is returned
     * <p><b>404</b> - Indicates the requested process definition was not found.
     * @param processDefinitionId The processDefinitionId parameter
     * @return String
     * @throws RestClientException if an error occurs while attempting to invoke the API
     */
    public String getProcessDefinitionStartForm(String processDefinitionId) throws RestClientException {
        Object postBody = null;

        // verify the required parameter 'processDefinitionId' is set
        if (processDefinitionId == null) {
            throw new HttpClientErrorException(HttpStatus.BAD_REQUEST, "Missing the required parameter 'processDefinitionId' when calling getProcessDefinitionStartForm");
        }

        // create path and map variables
        final Map<String, Object> uriVariables = new HashMap<String, Object>();
        uriVariables.put("processDefinitionId", processDefinitionId);
        String path = UriComponentsBuilder.fromPath("/repository/process-definitions/{processDefinitionId}/start-form").buildAndExpand(uriVariables).toUriString();

        final MultiValueMap<String, String> queryParams = new LinkedMultiValueMap<String, String>();
        final HttpHeaders headerParams = new HttpHeaders();
        final MultiValueMap<String, Object> formParams = new LinkedMultiValueMap<String, Object>();

        final String[] accepts = {
            "application/json"
        };
        final List<MediaType> accept = apiClient.selectHeaderAccept(accepts);
        final String[] contentTypes = { };
        final MediaType contentType = apiClient.selectHeaderContentType(contentTypes);

        String[] authNames = new String[] { "basicAuth" };

        ParameterizedTypeReference<String> returnType = new ParameterizedTypeReference<String>() {};
        return apiClient.invokeAPI(path, HttpMethod.GET, queryParams, postBody, headerParams, formParams, accept, contentType, authNames, returnType);
    }
    /**
     * List decision tables for a process-definition
     *
     * <p><b>200</b> - Indicates the process definition was found and the decision tables are returned.
     * <p><b>404</b> - Indicates the requested process definition was not found.
     * @param processDefinitionId The processDefinitionId parameter
     * @return List&lt;DecisionTableResponse&gt;
     * @throws RestClientException if an error occurs while attempting to invoke the API
     */
    public List<DecisionTableResponse> listProcessDefinitionDecisionTables(String processDefinitionId) throws RestClientException {
        Object postBody = null;

        // verify the required parameter 'processDefinitionId' is set
        if (processDefinitionId == null) {
            throw new HttpClientErrorException(HttpStatus.BAD_REQUEST, "Missing the required parameter 'processDefinitionId' when calling listProcessDefinitionDecisionTables");
        }

        // create path and map variables
        final Map<String, Object> uriVariables = new HashMap<String, Object>();
        uriVariables.put("processDefinitionId", processDefinitionId);
        String path = UriComponentsBuilder.fromPath("/repository/process-definitions/{processDefinitionId}/decision-tables").buildAndExpand(uriVariables).toUriString();

        final MultiValueMap<String, String> queryParams = new LinkedMultiValueMap<String, String>();
        final HttpHeaders headerParams = new HttpHeaders();
        final MultiValueMap<String, Object> formParams = new LinkedMultiValueMap<String, Object>();

        final String[] accepts = {
            "application/json"
        };
        final List<MediaType> accept = apiClient.selectHeaderAccept(accepts);
        final String[] contentTypes = { };
        final MediaType contentType = apiClient.selectHeaderContentType(contentTypes);

        String[] authNames = new String[] { "basicAuth" };

        ParameterizedTypeReference<List<DecisionTableResponse>> returnType = new ParameterizedTypeReference<List<DecisionTableResponse>>() {};
        return apiClient.invokeAPI(path, HttpMethod.GET, queryParams, postBody, headerParams, formParams, accept, contentType, authNames, returnType);
    }
    /**
     * List form definitions for a process-definition
     *
     * <p><b>200</b> - Indicates the process definition was found and the form definitions are returned.
     * <p><b>404</b> - Indicates the requested process definition was not found.
     * @param processDefinitionId The processDefinitionId parameter
     * @return List&lt;FormDefinitionResponse&gt;
     * @throws RestClientException if an error occurs while attempting to invoke the API
     */
    public List<FormDefinitionResponse> listProcessDefinitionFormDefinitions(String processDefinitionId) throws RestClientException {
        Object postBody = null;

        // verify the required parameter 'processDefinitionId' is set
        if (processDefinitionId == null) {
            throw new HttpClientErrorException(HttpStatus.BAD_REQUEST, "Missing the required parameter 'processDefinitionId' when calling listProcessDefinitionFormDefinitions");
        }

        // create path and map variables
        final Map<String, Object> uriVariables = new HashMap<String, Object>();
        uriVariables.put("processDefinitionId", processDefinitionId);
        String path = UriComponentsBuilder.fromPath("/repository/process-definitions/{processDefinitionId}/form-definitions").buildAndExpand(uriVariables).toUriString();

        final MultiValueMap<String, String> queryParams = new LinkedMultiValueMap<String, String>();
        final HttpHeaders headerParams = new HttpHeaders();
        final MultiValueMap<String, Object> formParams = new LinkedMultiValueMap<String, Object>();

        final String[] accepts = {
            "application/json"
        };
        final List<MediaType> accept = apiClient.selectHeaderAccept(accepts);
        final String[] contentTypes = { };
        final MediaType contentType = apiClient.selectHeaderContentType(contentTypes);

        String[] authNames = new String[] { "basicAuth" };

        ParameterizedTypeReference<List<FormDefinitionResponse>> returnType = new ParameterizedTypeReference<List<FormDefinitionResponse>>() {};
        return apiClient.invokeAPI(path, HttpMethod.GET, queryParams, postBody, headerParams, formParams, accept, contentType, authNames, returnType);
    }
    /**
     * List candidate starters for a process-definition
     *
     * <p><b>200</b> - Indicates the process definition was found and the requested identity links are returned.
     * <p><b>404</b> - Indicates the requested process definition was not found.
     * @param processDefinitionId The processDefinitionId parameter
     * @return List&lt;RestIdentityLink&gt;
     * @throws RestClientException if an error occurs while attempting to invoke the API
     */
    public List<RestIdentityLink> listProcessDefinitionIdentityLinks(String processDefinitionId) throws RestClientException {
        Object postBody = null;

        // verify the required parameter 'processDefinitionId' is set
        if (processDefinitionId == null) {
            throw new HttpClientErrorException(HttpStatus.BAD_REQUEST, "Missing the required parameter 'processDefinitionId' when calling listProcessDefinitionIdentityLinks");
        }

        // create path and map variables
        final Map<String, Object> uriVariables = new HashMap<String, Object>();
        uriVariables.put("processDefinitionId", processDefinitionId);
        String path = UriComponentsBuilder.fromPath("/repository/process-definitions/{processDefinitionId}/identitylinks").buildAndExpand(uriVariables).toUriString();

        final MultiValueMap<String, String> queryParams = new LinkedMultiValueMap<String, String>();
        final HttpHeaders headerParams = new HttpHeaders();
        final MultiValueMap<String, Object> formParams = new LinkedMultiValueMap<String, Object>();

        final String[] accepts = {
            "application/json"
        };
        final List<MediaType> accept = apiClient.selectHeaderAccept(accepts);
        final String[] contentTypes = { };
        final MediaType contentType = apiClient.selectHeaderContentType(contentTypes);

        String[] authNames = new String[] { "basicAuth" };

        ParameterizedTypeReference<List<RestIdentityLink>> returnType = new ParameterizedTypeReference<List<RestIdentityLink>>() {};
        return apiClient.invokeAPI(path, HttpMethod.GET, queryParams, postBody, headerParams, formParams, accept, contentType, authNames, returnType);
    }
    /**
     * List of process definitions
     *
     * <p><b>200</b> - Indicates request was successful and the process-definitions are returned
     * <p><b>400</b> - Indicates a parameter was passed in the wrong format or that latest is used with other parameters other than key and keyLike. The status-message contains additional information.
     * @param version Only return process definitions with the given version.
     * @param name Only return process definitions with the given name.
     * @param nameLike Only return process definitions with a name like the given name.
     * @param key Only return process definitions with the given key.
     * @param keyLike Only return process definitions with a name like the given key.
     * @param resourceName Only return process definitions with the given resource name.
     * @param resourceNameLike Only return process definitions with a name like the given resource name.
     * @param category Only return process definitions with the given category.
     * @param categoryLike Only return process definitions with a category like the given name.
     * @param categoryNotEquals Only return process definitions which do not have the given category.
     * @param deploymentId Only return process definitions with the given category.
     * @param startableByUser Only return process definitions which are part of a deployment with the given id.
     * @param latest Only return the latest process definition versions. Can only be used together with key and keyLike parameters, using any other parameter will result in a 400-response.
     * @param suspended If true, only returns process definitions which are suspended. If false, only active process definitions (which are not suspended) are returned.
     * @param sort Property to sort on, to be used together with the order.
     * @return DataResponseProcessDefinitionResponse
     * @throws RestClientException if an error occurs while attempting to invoke the API
     */
    public DataResponseProcessDefinitionResponse listProcessDefinitions(Integer version, String name, String nameLike, String key, String keyLike, String resourceName, String resourceNameLike, String category, String categoryLike, String categoryNotEquals, String deploymentId, String startableByUser, Boolean latest, Boolean suspended, String sort) throws RestClientException {
        Object postBody = null;

        String path = UriComponentsBuilder.fromPath("/repository/process-definitions").build().toUriString();

        final MultiValueMap<String, String> queryParams = new LinkedMultiValueMap<String, String>();
        final HttpHeaders headerParams = new HttpHeaders();
        final MultiValueMap<String, Object> formParams = new LinkedMultiValueMap<String, Object>();

        queryParams.putAll(apiClient.parameterToMultiValueMap(null, "version", version));
        queryParams.putAll(apiClient.parameterToMultiValueMap(null, "name", name));
        queryParams.putAll(apiClient.parameterToMultiValueMap(null, "nameLike", nameLike));
        queryParams.putAll(apiClient.parameterToMultiValueMap(null, "key", key));
        queryParams.putAll(apiClient.parameterToMultiValueMap(null, "keyLike", keyLike));
        queryParams.putAll(apiClient.parameterToMultiValueMap(null, "resourceName", resourceName));
        queryParams.putAll(apiClient.parameterToMultiValueMap(null, "resourceNameLike", resourceNameLike));
        queryParams.putAll(apiClient.parameterToMultiValueMap(null, "category", category));
        queryParams.putAll(apiClient.parameterToMultiValueMap(null, "categoryLike", categoryLike));
        queryParams.putAll(apiClient.parameterToMultiValueMap(null, "categoryNotEquals", categoryNotEquals));
        queryParams.putAll(apiClient.parameterToMultiValueMap(null, "deploymentId", deploymentId));
        queryParams.putAll(apiClient.parameterToMultiValueMap(null, "startableByUser", startableByUser));
        queryParams.putAll(apiClient.parameterToMultiValueMap(null, "latest", latest));
        queryParams.putAll(apiClient.parameterToMultiValueMap(null, "suspended", suspended));
        queryParams.putAll(apiClient.parameterToMultiValueMap(null, "sort", sort));

        final String[] accepts = {
            "application/json"
        };
        final List<MediaType> accept = apiClient.selectHeaderAccept(accepts);
        final String[] contentTypes = { };
        final MediaType contentType = apiClient.selectHeaderContentType(contentTypes);

        String[] authNames = new String[] { "basicAuth" };

        ParameterizedTypeReference<DataResponseProcessDefinitionResponse> returnType = new ParameterizedTypeReference<DataResponseProcessDefinitionResponse>() {};
        return apiClient.invokeAPI(path, HttpMethod.GET, queryParams, postBody, headerParams, formParams, accept, contentType, authNames, returnType);
    }
    /**
     * Migrate all instances of process definition
     *
     * <p><b>200</b> - Indicates process instances were found and migration was executed.
     * <p><b>404</b> - Indicates the requested process definition was not found.
     * @param processDefinitionId The processDefinitionId parameter
     * @param body The body parameter
     * @throws RestClientException if an error occurs while attempting to invoke the API
     */
    public void migrateInstancesOfProcessDefinition(String processDefinitionId, String body) throws RestClientException {
        Object postBody = body;

        // verify the required parameter 'processDefinitionId' is set
        if (processDefinitionId == null) {
            throw new HttpClientErrorException(HttpStatus.BAD_REQUEST, "Missing the required parameter 'processDefinitionId' when calling migrateInstancesOfProcessDefinition");
        }

        // create path and map variables
        final Map<String, Object> uriVariables = new HashMap<String, Object>();
        uriVariables.put("processDefinitionId", processDefinitionId);
        String path = UriComponentsBuilder.fromPath("/repository/process-definitions/{processDefinitionId}/migrate").buildAndExpand(uriVariables).toUriString();

        final MultiValueMap<String, String> queryParams = new LinkedMultiValueMap<String, String>();
        final HttpHeaders headerParams = new HttpHeaders();
        final MultiValueMap<String, Object> formParams = new LinkedMultiValueMap<String, Object>();

        final String[] accepts = {
            "application/json"
        };
        final List<MediaType> accept = apiClient.selectHeaderAccept(accepts);
        final String[] contentTypes = { };
        final MediaType contentType = apiClient.selectHeaderContentType(contentTypes);

        String[] authNames = new String[] { "basicAuth" };

        ParameterizedTypeReference<Void> returnType = new ParameterizedTypeReference<Void>() {};
        apiClient.invokeAPI(path, HttpMethod.POST, queryParams, postBody, headerParams, formParams, accept, contentType, authNames, returnType);
    }
}
